package com.sixmac.controller;

import com.sixmac.annotation.AuthUser;
import com.sixmac.common.base.BaseController;
import com.sixmac.core.toolbox.ajax.AjaxResult;
import com.sixmac.platform.service.IndexService;
import com.sixmac.util.RandomValue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by admin on 2018/9/5.
 */
@Controller
@RequestMapping("/index")
@ResponseBody
public class IndexController extends BaseController {
    @Autowired
    IndexService indexService;

    /**
     * @api {post} /index/recordRoom 0.1录入房屋信息
     * @apiName index.index
     * @apiGroup index
     * @apiParam {String} token token
     * @apiParam {String} lng 经度
     * @apiParam {String} lat 纬度
     * @apiParam {String} address 详细地址 比如 武汉光谷科技2楼1902
     * @apiParam {String} region 房屋区域 areaCode的值
     * @apiParam {String} images 房源图片 多个用,分隔
     * @apiParam {String} mobile 房东手机
     * @apiParam {String} lockNo 锁的编号
     * @apiSuccess {String} user.id 安装员id
     * @apiSuccess {String} user.token token
     * @apiSuccess {String} user.name 名称
     * @apiSuccess {String} user.sex 性别 1男2女
     */
    @AuthUser
    @RequestMapping("/recordRoom")
    public AjaxResult recordRoom(String lng, String lat, String address, Integer region, String images, String mobile, String lockNo) {
        return indexService.recordRoom(lng, lat, region, address, images, mobile, lockNo);
    }

    @RequestMapping("/insert")
    public AjaxResult insert() {
//        for (int i=0;i<=1000;i++)
        RandomValue.getAddress();
        return success("");
    }
}
